﻿CREATE TABLE [dbo].[TipPrezenta] (
    [CodPrezenta]   VARCHAR (15)   NULL,
    [CodListare]    VARCHAR (15)   NULL,
    [Ordonare]      TINYINT        NULL,
    [TimpBaza]      CHAR (1)       NULL,
    [IdTipPrezenta] SMALLINT       IDENTITY (1, 1) NOT NULL,
    [Descriere]     VARCHAR (100)  NULL,
    [DataDefinire]  DATETIME       NULL,
    [Selectat]      BIT            NOT NULL,
    [SeListeaza]    BIT            NOT NULL,
    [IdOpContabila] INT            NOT NULL,
    [Tip]           CHAR (1)       DEFAULT ('P') NOT NULL,
    [ProcentBaza]   DECIMAL (5, 2) DEFAULT ((0)) NOT NULL,
    [InclusCAS]     BIT            DEFAULT ((0)) NOT NULL,
    [CodUnitate]    SMALLINT       DEFAULT ((0)) NOT NULL,
    CONSTRAINT [PK_TipPrezenta] PRIMARY KEY CLUSTERED ([IdTipPrezenta] ASC),
    CONSTRAINT [CK_TipPrezenta_TimpBaza] CHECK ([TimpBaza]='O' OR [TimpBaza]='Z' OR [TimpBaza]='V'),
    CONSTRAINT [CK_TipPrezenta_Tip] CHECK ([Tip]='P' OR [Tip]='O' OR [Tip]='N' OR [Tip]='X'),
    CONSTRAINT [FK_TipPrezenta_Unitati] FOREIGN KEY ([CodUnitate]) REFERENCES [dbo].[Unitati] ([CodUnitate])
);

